#ifndef GATE_LISTENER_IMPL_H
#define GATE_LISTENER_IMPL_H

#include "gate_module.h"

namespace utility
{
namespace network
{
    class gate_listener_impl : public gate_listener, session_mgr
    {
    public:
        // standard constructor
        gate_listener_impl(net_module * );

        // standard destructor
        ~gate_listener_impl(void);

    public:
        // initialize
        virtual bool initialize(session_mgr *);

        // begin to listen specify TCP port
        virtual bool start(const char * ip_address, const char * port);

        virtual void release() {delete this;}

        virtual void on_accept(utility::network::session *);

        virtual void set_max_recv_buf_size(uint32 size);

        virtual void broadcast(std::list<session *> sessions, void * message, size_t message_length);

        session_mgr * get_session_mgr();
    protected:
        session_mgr * session_mgr_;
        listener * listener_;
    };
}
}

#endif // endif of GATE_LISTENER_IMPL_H
